/* eslint-disable */

// 工具
import util from '@/libs/util.ice';
// 页面和布局
import Index from '@/pages/Index';
import Login from '@/pages/Login'
// 系统选择
import SystemLibrary from '@/pages/SystemLibrary'
import AddSystem from '@/pages/SystemLibrary/children/AddSystem'

import Error404 from '@/pages/Error404';
// import Demo1 from '@/pages/Demo1';
// import Demo2 from '@/pages/Demo2';
import HeaderAside from '@/layouts/HeaderAside';
import RoomStatus from '@/pages/RoomStatus';
import TodayRoom from '@/pages/RoomStatus/children/TodayRoom';
import ChannelStatus from '@/pages/RoomStatus/children/ChannelStatus';
// 客户
import Client from '@/pages/Client';
import ClientDetails from '@/pages/Client/children/ClientDetails';
// 订单管理
import OrderManage from '@/pages/OrderManage';
import OrderList from '@/pages/OrderManage/children/OrderList/OrderList.vue';
// 测试
import test from '@/pages/test';
// 消息
import Messages from '@/pages/Messages';
import OrderMessages from '@/pages/Messages/children/OrderMessages';

// 钱包
import Wallet from '@/pages/Wallet';
//统计 营收
import Statistics from '@/pages/Statistics';
import Business from '@/pages/Statistics/children/Business';//营业汇总
import Proceeds from '@/pages/Statistics/children/Proceeds';//收款汇总
import ChannelSummary from '@/pages/Statistics/children/ChannelSummary';//渠道汇总
import GuestRoom from '@/pages/Statistics/children/GuestRoom';//客服营业汇总
import RecordSummary from '@/pages/Statistics/children/RecordSummary';//记一笔汇总
import ConsumptionDetails from '@/pages/Statistics/children/ConsumptionDetails';//消费明细报表
import ShiftWorkTable from '@/pages/Statistics/children/ShiftWorkTable';//交接班表
// 设置
import Settings from '@/pages/Settings';
import ListAccount from '@/pages/Settings/children/ListAccount';
import ChangeAccount from '@/pages/Settings/children/ChangeAccount';
import AddAccount from '@/pages/Settings/children/AddAccount';
import RoomTypeSetting from '@/pages/Settings/children/RoomTypeSetting';
import RoomGroupingSetting from '@/pages/Settings/children/RoomGroupingSetting';
import SortingSetting from '@/pages/Settings/children/SortingSetting';
import ConsumptionSetting from '@/pages/Settings/children/ConsumptionSetting';
import HourRoomSetting from '@/pages/Settings/children/HourRoomSetting';
import RoomPriceSetting from '@/pages/Settings/children/RoomPriceSetting';
import BatchSetting from '@/pages/Settings/children/BatchSetting';
import PriceChangeRecordSetting from '@/pages/Settings/children/PriceChangeRecordSetting';
import RoomType from '@/pages/Settings/children/RoomType';
import BranchInformation from '@/pages/Settings/children/BranchInformation';
import RoomDeatil from '@/pages/Settings/children/RoomType/RoomDeatil';
import PaymentMethodSetting from '@/pages/Settings/children/PaymentMethodSetting';
import MakeAbill from '@/pages/Settings/children/MakeAbill';
import HousingResource from '@/pages/Settings/children/HousingResource';
import CashPledge from '@/pages/Settings/children/CashPledge';
import notifications from '@/pages/Settings/children/notifications';


// 超市
import Supermarket from '@/pages/Supermarket';
import CategoryManagement from '@/pages/Supermarket/children/CategoryManagement/CategoryManagement.vue';
import GoodsManagement from '@/pages/Supermarket/children/GoodsManagement/GoodsManagement.vue';
import StockManagement from '@/pages/Supermarket/children/StockManagement/StockManagement.vue';
import Stockrecords from '@/pages/Supermarket/children/Stockrecords/Stockrecords.vue';
import SupermarketSetting from '@/pages/Supermarket/children/SupermarketSetting/SupermarketSetting.vue';
import TopMenuSupermarket from '@/pages/Supermarket/children/TopMenuSupermarket/TopMenuSupermarket.vue';
import AddGoods from '@/pages/Supermarket/children/addGoods/addGoods.vue';


// 渠道
import TopChannel from '../pages/Channel/TopChannel.vue';
import ChannelList from '@/pages/Channel/children/ChannelList/ChannelList.vue';
import ConnectionSetting from '@/pages/Channel/children/ConnectionSetting/ConnectionSetting.vue';

// 用户
import User from '@/pages/User/User.vue';
import ExportRepot from '@/pages/User/children/ExportRepot/ExportRepot.vue';
import ImportRepot from '@/pages/User/children/ImportRepot/ImportRepot.vue';


// 如果不指定 name 字段，会根据 path 生成 name = page-demo1
// 转换规则见 util.recursiveRouterConfig 中 path2name 方法
// meta 字段会和默认值使用 Object.assign 合并
// 如果不指定 meta.name 的话，name 字段会使用和上面路由 name 一样的取值逻辑
// 下面两个页面就是对比 你可以分别观察两个页面上显示的路由数据差异

// 变量名 routerConfig 为 iceworks 检测关键字
// ice 会自动在这个变量下添加路由数据
// 请不要修改名称
const routerConfig = [
  {
    path: '/',
    component: HeaderAside,
    children: [

      // { path: 'demo1', component: Demo1 },
      // { path: 'demo2', component: Demo2 },
      { path: 'TodayRoom', component: TodayRoom, name: '单日房态' },
      { path: 'ChannelStatus', component: ChannelStatus, name: '渠道房态' },
      {
        path: 'RoomStatus', component: RoomStatus, name: '房态',
        children: [
          {
            path: '/',
            name: 'RoomStatusCalendar',
            component: () => import('../pages/RoomStatus/componnets/RoomCalendar'),
          },
          {
            path: '/Today',
            name: 'RoomStatusToday',
            component: () => import('../pages/RoomStatus/componnets/TodayRoom'),
          },
        ]
      },
      { path: 'Client', component: Client, name: '客户' },
      { path: 'ClientDetails', component: ClientDetails, name: '客户' },
      { path: 'test', component: test, name: '测试页面' },

      // 消息
      {
        path: 'Messages', component: Messages, name: '消息',
        children: [
          { path: 'OrderMessages', component: OrderMessages, name: 'OrderMessages' },
        ]
      },


      { path: 'Wallet', component: Wallet, name: '钱包' },
      // 统计
      {
        path: 'Statistics', component: Statistics,
        children: [
          { path: 'Business', component: Business, name: 'Business' },//营业汇总
          { path: 'Proceeds', component: Proceeds, name: 'Proceeds' },//收款汇总
          { path: 'ChannelSummary', component: ChannelSummary, name: 'ChannelSummary' },//渠道汇总
          { path: 'GuestRoom', component: GuestRoom, name: 'GuestRoom' },//客服营业汇总
          { path: 'RecordSummary', component: RecordSummary, name: 'RecordSummary' },//记一笔汇总
          { path: 'ConsumptionDetails', component: ConsumptionDetails, name: 'ConsumptionDetails' },//消费明细报表
          { path: 'ShiftWorkTable', component: ShiftWorkTable, name: 'ShiftWorkTable' }//交接班表
        ]
      },

      // 设置
      {
        path: 'Settings', component: Settings,
        children: [
          { path: 'ListAccount', component: ListAccount, name: 'ListAccount' },
          { path: 'ChangeAccount', component: ChangeAccount, name: 'ChangeAccount' },
          { path: 'AddAccount', component: AddAccount, name: 'AddAccount' },
          { path: 'RoomTypeSetting', component: RoomTypeSetting, name: 'RoomTypeSetting' },
          { path: 'RoomGroupingSetting', component: RoomGroupingSetting, name: 'RoomGroupingSetting' },
          { path: 'SortingSetting', component: SortingSetting, name: 'SortingSetting' },
          { path: 'ConsumptionSetting', component: ConsumptionSetting, name: 'ConsumptionSetting' },
          { path: 'HourRoomSetting', component: HourRoomSetting, name: 'HourRoomSetting' },
          { path: 'RoomPriceSetting', component: RoomPriceSetting, name: 'RoomPriceSetting' },
          { path: 'BatchSetting', component: BatchSetting, name: 'BatchSetting' },

          { path: 'PriceChangeRecordSetting', component: PriceChangeRecordSetting, name: 'PriceChangeRecordSetting' },
          { path: 'RoomType', component: RoomType, name: 'RoomType' },
          { path: 'BranchInformation', component: BranchInformation, name: 'BranchInformation' },
          { path: '/RoomType/RoomDeatil', component: RoomDeatil, name: 'RoomDeatil' },
          { path: 'PaymentMethodSetting', component: PaymentMethodSetting, name: 'PaymentMethodSetting' },
          { path: 'MakeAbill', component: MakeAbill, name: 'MakeAbill' },
          { path: 'HousingResource', component: HousingResource, name: 'HousingResource' },
          { path: 'CashPledge', component: CashPledge, name: 'CashPledge' },
          { path: 'notifications', component: notifications, name: 'notifications' },


          { path: 'GoodsManagement', component: GoodsManagement, name: 'GoodsManagement', },
          { path: 'SupermarketSetting', component: SupermarketSetting, name: 'SupermarketSetting' },
          { path: 'CategoryManagement', component: CategoryManagement, name: 'CategoryManagement' },
          { path: 'StockManagement', component: StockManagement, name: 'StockManagement' },
          { path: 'Stockrecords', component: Stockrecords, name: 'Stockrecords' },
          { path: 'AddGoods', component: AddGoods, name: 'AddGoods' },
        ]
      },
      {
        path: 'OrderManage', component: OrderManage,
        children: [
          {
            path: 'OrderList', component: OrderList, name: 'OrderList'
          }
        ]
      },

      // 超市
      {
        path: 'Supermarket', component: Supermarket, name: 'Supermarket',
        children: [
          // {path: 'GoodsManagement', component: GoodsManagement, name: 'GoodsManagement', },
          // { path: 'SupermarketSetting', component: SupermarketSetting, name: 'SupermarketSetting' },
          // { path: 'CategoryManagement', component: CategoryManagement, name: 'CategoryManagement' },
          // { path: 'StockManagement', component: StockManagement, name: 'StockManagement' },
          // { path: 'Stockrecords', component: Stockrecords, name: 'Stockrecords' },
          // { path: 'AddGoods', component: AddGoods, name: 'AddGoods' },
        ]
      },

      { path: 'TopMenuSupermarket', component: TopMenuSupermarket, name: '超市' },

      // 渠道
      {
        path: 'TopChannel', component: TopChannel, name: '渠道',
        children: [
          { path: 'ChannelList', component: ChannelList, name: 'ChannelList' },
          { path: 'ConnectionSetting', component: ConnectionSetting, name: 'ConnectionSetting' },
        ]
      },
      // keep the name param
      { path: '', component: Index, name: 'index' },

      // 用户User
      {
        path: 'User', component: User,
        children: [
          { path: 'ExportRepot', component: ExportRepot, name: 'ExportRepot' },//导出中心
          { path: 'ImportRepot', component: ImportRepot, name: 'ImportRepot' },//导入中心
        ]
      },
    ],
  },

  { path: '*', component: Error404 },
];


// 不参与菜单显示的
// ice 不会处理这部分
// 但是这部分路由也会被注册
// 处理规则同 routerConfig

const routerConfigMenuLogin = [
  // 登录
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {
      auth: false,
    },
  },

  { path: '/AddSystem', component: AddSystem, name: '添加门店' },
  { path: '/SystemLibrary', component: SystemLibrary, name: '系统库' },

  // 404
  {
    path: '*',
    component: Error404,
  },
];

// 导出全部路由设置
export default util.recursiveRouterConfig([
  ...routerConfig,
  ...routerConfigMenuLogin,
]);

function getFrameInRoutes() {
  const frameInRoutes = [];
  util.recursiveRouterConfig(routerConfig).forEach(e => {
    const { path, name, hidden, meta, children } = e;
    if (children) {
      children.forEach(child => {
        const { path, name, hidden, meta } = child;
        frameInRoutes.push({ path, name, hidden, meta });
      });
    } else {
      frameInRoutes.push({ path, name, hidden, meta });
    }
  });

  return frameInRoutes;
}

// 导出参与多标签页处理的路由设置
// 这个数据会在 main.js 中使用
export const frameInRoutes = getFrameInRoutes();
